﻿Public Class Rastreadores
    Private Sub Rastreadores_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CONTROLETableAdapter.Fill(Me.CONTROLEDataSet.CONTROLE)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        CONTROLEBindingSource.MoveFirst()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        CONTROLEBindingSource.MovePrevious()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        CONTROLEBindingSource.AddNew()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Try
            Me.Validate()
            CONTROLEBindingSource.EndEdit()
            TableAdapterManager.UpdateAll(Me.CONTROLEDataSet)
        Catch ex As Exception
            MsgBox("Erro ao inserir os dados" + Environment.NewLine + ex.ToString, MsgBoxStyle.Information, "Atenção")
        End Try
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Try
            Me.Validate()
            CONTROLEBindingSource.RemoveCurrent()
            CONTROLETableAdapter.Update(Me.CONTROLEDataSet.CONTROLE)
        Catch ex As Exception
            MsgBox("Erro ao deletar os dados" + Environment.NewLine + ex.ToString, MsgBoxStyle.Information, "Atenção")
        End Try
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        CONTROLEBindingSource.MoveNext()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        CONTROLEBindingSource.MoveLast()
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        CONTROLETableAdapter.Fill(Me.CONTROLEDataSet.CONTROLE)
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        If PINTextBox.Text = "" Then
            MsgBox("FAVOR INFORMAR A NUMERAÇÃO DO PIN", MsgBoxStyle.Information, "Atenção")
        Else
            CONTROLETableAdapter.FillByPIN(CONTROLEDataSet.CONTROLE, PINTextBox.Text)
        End If
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        If ENTRADAMaskedTextBox.Text = "  /  /" Then
            MsgBox("FAVOR INFORMAR A DATA DA ENTRADA", MsgBoxStyle.Information, "Atenção")
        Else
            CONTROLETableAdapter.FillByENTRADA(CONTROLEDataSet.CONTROLE, ENTRADAMaskedTextBox.Text)
        End If
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        If DISPONIBILIDADEComboBox.Text = "" Then
            MsgBox("FAVOR INFORMAR A DISPONIBILIDADE", MsgBoxStyle.Information, "Atenção")
        Else
            CONTROLETableAdapter.FillByDISPO(CONTROLEDataSet.CONTROLE, DISPONIBILIDADEComboBox.Text)
        End If
    End Sub
End Class